//
//  NewsViewController.m
//  wangyi
//
//  Created by dllo on 15/11/24.
//  Copyright (c) 2015年 liyinkai. All rights reserved.
//

#import "NewsViewController.h"

@interface NewsViewController ()<UIWebViewDelegate>
@property (nonatomic, retain) UIWebView *webview;
@property (nonatomic, copy) NSString *urlstr;
@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.backgroundColor = [UIColor yellowColor];
//    self.navigationController.navigationBarHidden = YES;
        self.navigationController.navigationBar.translucent = YES;
    NSLog(@"%@", _model.url);
    NSLog(@"%@", _model.docid);
    _webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, -120, self.view.bounds.size.width, self.view.bounds.size.height + 120)];
    _webview.dataDetectorTypes = UIDataDetectorTypeAll;
    _webview.scalesPageToFit = YES;
    _webview.delegate = self;
//    if (_model.url_3w) {
        _urlstr = _model.url;
//    } else {
//        _urlstr = [NSString stringWithFormat:@"http://c.3g.163.com/nc/article/%@/full.html", _model.docid];
//    }
    
    
    NSURL *url = [NSURL URLWithString:_urlstr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [self.webview loadRequest:request];
    [self.view addSubview:_webview];
    [_webview reload];
//    [self.webview loadHTMLString:@"<p>Hello</p>" baseURL:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
